<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">

</head>
<body>
    <div class="topjui-fluid">
        <fieldset>
            <legend>参数说明</legend>
        </fieldset>
        <div class="topjui-row">
            <div class="topjui-col-sm4">
				<label class="topjui-form-label">工号：</label>
				<div class="topjui-input-block">
				<input id="empnum" type="text" name="empnum"
                           style="" class="textbox-f" data-toggle="topjui-textbox"
                           data-options="required:true,prompt:'必填',validType:'maxLength[10]'"  />
				</div>
            </div>
            <div class="topjui-col-sm4">
				<label class="topjui-form-label">姓名：</label>
				<div class="topjui-input-block">
				<input id="name" type="text" name="name"
                           style="" class="textbox-f" data-toggle="topjui-textbox"
                           data-options="required:true,prompt:'必填',validType:'maxLength[20]'"  />
				</div>
            </div>
        </div>

        <div class="topjui-row">
            <div class="topjui-col-sm4">
                <label class="topjui-form-label">性别：</label>
                <div class="topjui-input-block">
				<input type="text" name="sex" id="sex"
                           data-toggle="topjui-combobox"
                           data-options="required:true,prompt:'必填',
	                        			 panelHeight:80,
                           		         data:[{value:'男',text:'男'},{value:'女',text:'女'}]">
                </div>
            </div>
            <div class="topjui-col-sm4">
                <label class="topjui-form-label">电话：</label>
                <div class="topjui-input-block">
                
				<input id="telephone" type="text" name="telephone"
                           style="" class="textbox-f" data-toggle="topjui-textbox"
                           data-options="required:false,validType:'cellphone'"  />
                </div>
            </div>
        </div>

        <div class="topjui-row">
            <div class="topjui-col-sm8">
                <label class="topjui-form-label">部门：</label>
                <div class="topjui-input-block">
					<input type="text" name="depid" id="depid"
		                   data-toggle="topjui-combotree"
		                   data-options="required:true,prompt:'必填',
		               method:'get',
		               valueField:'id',
		               textField:'text',
	                   panelHeight:250,
		               onSelect:function(node){
		               //$('#posid_a') 联动职位下拉
		               //alert($('form[id^=userDg]:first').attr('id'))
		               //add bypengwwang 分析了原因直接取id 页面中存在id相同的元素  这些id相同的元素其实是在不同的form中只要精确找到form中的id 即可
		               	$('form[id^=userDg]:first').find('#posid').combobox({
		               		url:'/user/queryPos?depid='+node.id,
		               		method: 'get', 
		               		width:159,           
		        			valueField: 'id',//绑定字段ID            
		        			textField: 'text',//绑定字段Name            
		        			panelHeight: 'auto',//自适应   
		        			multiple: false
		               	});
		               },
		               onLoadSuccess:function(data,node){
		               //add bypengwang 添加部门回显
		               	var _this = this;
		               		$.get('/user/getDep?userid='+ID,function(result){
		               			var jsondata = JSON.parse(result);//得到回显数据
		               			$('#depid').combotree('setValue',jsondata.data[0].id);//回显部门
		               			//alert(jsondata.data[0].posname)
		               			
		               				//重新触发联动 将职位信息框定在联动区域
		               				$('form[id^=userDg]:first').find('#posid').combobox({
					               		url:'/user/queryPos?depid='+jsondata.data[0].id,
					               		method: 'get', 
					               		width:159,           
					        			valueField: 'id',//绑定字段ID            
					        			textField: 'text',//绑定字段Name            
					        			panelHeight: 'auto',//自适应   
					        			multiple: false,
					        			value:jsondata.data[0].cid//设置默认值 就是回显职位
					               	});
  							});
		               },
		               url:'/user/queryDep'">
                </div>
            </div>
           
        </div>

        <div class="topjui-row">
         <div class="topjui-col-sm4">
                <label class="topjui-form-label">职位：</label>
                 <!-- 将id id="posid" 改为posid_a -->
                <div class="topjui-input-block">
	               <input type="text" name="posid"
 	                   data-toggle="topjui-combo" id="posid" 
	                   data-options="required:true,
	               prompt:'职位',
	               valueField:'id',
	               textField:'text',
	               method:'get',
	               panelHeight:220,
	               multiple:false">
                </div>
            </div>
            <div class="topjui-col-sm4">
                <label class="topjui-form-label">权限模版：</label>
                <div class="topjui-input-block">
		             <input type="text" name="roleid" id="roleid"
		                   data-toggle="topjui-combobox"
		                   data-options="required:true,
		               prompt:'权限模版',
		               valueField:'id',
		               textField:'text',
		               method:'get',
	                   panelHeight:200,
		               onLoadSuccess:function(data){
		               		$.get('/user/getRole?userid='+ID,function(result){
		               			var jsondata = JSON.parse(result);
		               			 $('#roleid').combobox('setValue',jsondata.data[0].id);
  							});
		               },
		               url:'/user/queryRole'">
                </div>
            </div>
            <div class="topjui-col-sm4"><!-- 这个补齐的目的是与上面的统一 -->
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">
</script>
</html>